<template>
<!--    楼盘测评里面的  两个标题下面的  表格组件====ZxHouseTest页面-->
    <div>
        <el-table align="center"
                ref="multipleTable"
                :data="tableData"
                tooltip-effect="dark"
                style="width: 100%"
                @selection-change="handleSelectionChange">
            <el-table-column align="center"
                    type="selection"
                    width="55">
            </el-table-column>
            <el-table-column align="center"
                    prop="houseId"
                    label="楼盘编码"
                    min-width="90">
            </el-table-column>
            <el-table-column align="center"
                    prop="houseName"
                    label="楼盘名称"
                    min-width="140">
            </el-table-column>
            <el-table-column align="center"
                    prop="housePrice"
                    label="楼盘价格"
                    min-width="80">
            </el-table-column>
            <el-table-column align="center"
                    prop="houseWeight"
                    label="权重"
                    min-width="40">
            </el-table-column>
            <el-table-column align="center"
                    prop="houseViews"
                    label="浏览量"
                    min-width="50">
            </el-table-column>
            <el-table-column align="center"
                    prop="HouseAnalysts"
                    label="责任分析师"
                    min-width="80">
            </el-table-column>
            <el-table-column align="center"
                    prop="analysts"
                    label="分析师"
                    min-width="50">
            </el-table-column>
            <el-table-column align="center"
                    prop="supervisorName"
                    label="键盘"
                    min-width="50">
            </el-table-column>
            <el-table-column align="center"
                    prop="address"
                    label="地址"
                    show-overflow-tooltip
                    min-width="50">
            </el-table-column>
            <el-table-column align="center" label="操作" min-width="150">
                <div v-if="myChangBtn==='first' || myChangBtn==='' ">
                    <el-button size="mini" round @click="addHouseTest()">发布测评</el-button>
                    <el-button size="mini" round>编辑测评</el-button>
                </div>
                <div  v-else-if="myChangBtn==='second'">
                    <el-button size="mini" round >预览测评</el-button>
                    <el-button size="mini" round>编辑测评</el-button>
                </div>
            </el-table-column>
        </el-table>
        <el-pagination
                background
                layout="prev, pager, next"
                :total="tableData.length">
        </el-pagination>
        <div style="margin-top: 20px">
            <el-button @click="toggleSelection([tableData[1], tableData[2]])">选中某一行状态</el-button>
            <el-button @click="toggleSelection()">取消选择</el-button>
        </div>
    </div>
</template>

<script>
    export default {
        name: "ZxHouseTestTable",
        data() {
            return {
                tableData: [{
                    houseId:1123123213,
                    houseName:'中洲中央城邦(住宅、商铺)',
                    housePrice:'8000元/平米',
                    houseWeight:'5级',
                    houseViews:1,
                    HouseAnalysts:'王小虎',
                    analysts:'李四',
                    supervisorName:'王小虎',
                    date: '2016-05-03',
                    address: '上海市普陀区金沙江路 1518 弄'
                },
                {
                houseId:1123123213,
                houseName:'中洲中央城邦(住宅、商铺)',
                housePrice:'8000元/平米',
                houseWeight:'5级',
                houseViews:1,
                HouseAnalysts:'王小虎',
                analysts:'李四',
                supervisorName:'王小虎',
                date: '2016-05-03',
                address: '上海市普陀区金沙江路 1518 弄'
                },
                {
                houseId:1123123213,
                houseName:'中洲中央城邦(住宅、商铺)',
                housePrice:'8000元/平米',
                houseWeight:'5级',
                houseViews:1,
                HouseAnalysts:'王小虎',
                analysts:'李四',
                supervisorName:'王小虎',
                date: '2016-05-03',
                address: '上海市普陀区金沙江路 1518 弄'
                },
                {
                houseId:1123123213,
                houseName:'中洲中央城邦(住宅、商铺)',
                housePrice:'8000元/平米',
                houseWeight:'5级',
                houseViews:1,
                HouseAnalysts:'王小虎',
                analysts:'李四',
                supervisorName:'王小虎',
                date: '2016-05-03',
                address: '上海市普陀区金沙江路 1518 弄'
                },],
                multipleSelection: []
            }

        },
        computed:{
            myChangBtn(){
                return this.$store.state.MenuCount.titleName;
            }

        },
        created() {

        },
        methods: {
            /*全选哪里的方法 ===暂未写*/
            toggleSelection(rows) {
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
                }
            },
            handleSelectionChange(val) {
                this.multipleSelection = val;
            },
            /*点击发布测评====跳转到测评的详情界面*/
            addHouseTest(){
                this.$router.push({
                    name:'ZxReleaseHouseTest',
                    path:'/Home/ZxHousingManager/ZxReleaseHouseTest',
                    query: {

                    },
                })
            },
        }
    }
</script>

<style scoped>

</style>